// pages/caicaicai/index.js
var numUser;
var numComputer;
Page({
  data:{
    history:[],

  },
  
  inputData(e){
    numUser=parseInt(e.detail.value);
  },

  caicaicai:function(e){
    let history=this.data.history;
    history.push(numUser);
    var mess=null;
    if(numUser==numComputer){
      mess="恭喜你,猜对了";
    }else if(numUser<numComputer){
      mess="sorry,猜小啦";
    }else{
      mess="sorry,猜大了";
    }
    this.setData({result:mess,in:numUser,chongzhi:'',focus:true,history,});
  },
  onLoad:function(options){
    numComputer=parseInt(Math.random()*100);
    console.log("计算机心里想的："+numComputer);
  },
})